package 找单独的数;
public class ans {
    public static int solution(int[] cards) {
        //使用01数组
        int[] arr=new int[1000];
        for(int card:cards){
            if(arr[card]==0){
                arr[card]=1;
            }
            else{
                arr[card]=0;
            }
        }
        for(int num=0;num<arr.length;num++){
            if(arr[num]==1){
                return num;
            }
        }
        return 0;
    }

    public static void main(String[] args) {
        // Add your test cases here

        System.out.println(solution(new int[]{1, 1, 2, 2, 3, 3, 4, 5, 5}) == 4);
        System.out.println(solution(new int[]{0, 1, 0, 1, 2}) == 2);
    }
}
